

var Api = require('../../utils/api.js');

var wxRequest = require('../../utils/wxRequest.js')
const Adapter = require('../../utils/adapter.js')
var webSiteName= config.getWebsiteName;
var domain =config.getDomain

import config from '../../utils/config.js'

Page({
  data: {
    title: '产品列表',
    postsList: {},  
    page: 1,
    search: '', 
    showerror:"none", 
    showallDisplay: "block",
    displaySwiper: "block",
    floatDisplay: "none", 
    list: []
  },
  onLoad: function (options) {
    var self = this;
    var product = wxRequest.getRequest(Api.getProduct());
    product.then(res => {
      self.setData({
        list:res.data, 
      }); 
    });
  },
  click_product:function(options){
      let id = options.currentTarget.dataset.status;
      var product = wxRequest.getRequest(Api.getProductList(id));
      product.then(res => {
         if(res.data.length == 0){
            this.$showDialog({
              content: '敬请期待',
              showCancel: false,
              success: res => {
                  console.log(res);
              }
            });
            return false;
         }else{
            wx.navigateTo({
              url: './productlist?id='+id,
            })
         }
      });
      
  },
})



